package com.lixin.admin.server.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel("返回信息")
public class CommonResponseVO<T> implements Serializable {
    @ApiModelProperty("返回状态码")
    private Integer code;
    @ApiModelProperty("返回消息")
    private String message;
    @ApiModelProperty("返回数据")
    private T data;

    public CommonResponseVO() {}

    public CommonResponseVO(ResponseCode responseCode) {
        this(responseCode, null);
    }

    public CommonResponseVO(ResponseCode responseCode, T data) {
        this(responseCode.getCode(), responseCode.getMessage(), data);
    }

    public CommonResponseVO(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
